USE [WEALTHDB]
GO

/****** Object:  Table [dbo].[setting]    Script Date: 02/21/2013 00:24:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[setting](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[textValue] [nvarchar](200) NULL,
	[type] [nvarchar](10) NULL,
	[enableFlag] [int] NULL,
 CONSTRAINT [PK_etting] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


USE [WEALTHDB]
GO

/****** Object:  Table [dbo].[PointList]    Script Date: 02/21/2013 00:25:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[PointList](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[cusId] [nvarchar](50) NULL,
	[orderPoint] [int] NULL,
	[orderId] [nvarchar](50) NULL,
	[createDate] [datetime] NULL,
	[isClosed] [varchar](1) NULL,
	[memo] [nvarchar](500) NULL,
	[endModifyDate] [nchar](10) NULL,
 CONSTRAINT [PK_Point] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


USE [WEALTHDB]
GO

/****** Object:  StoredProcedure [dbo].[Get_setting]    Script Date: 02/21/2013 00:25:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<mate>
-- Create date: <2013.02.10>
-- Description:	<Login>
-- =============================================
create PROCEDURE [dbo].[Get_setting]
	-- Add the parameters for the stored procedure here
	@type varchar(10)
	
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT id,
	textValue,
	type,
	enableFlag
		  FROM [setting] where type = @type;
END

GO


USE [WEALTHDB]
GO

/****** Object:  StoredProcedure [dbo].[setting_Insert]    Script Date: 02/21/2013 00:26:14 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<mate>
-- Create date: <2013,01,10>
-- Description:	<UserAdd>
-- =============================================
CREATE PROCEDURE [dbo].[setting_Insert]
	-- Add the parameters for the stored procedure here
	@ID int,
	@TOPTEXT varchar(200),  
	@status int,  
	@type varchar(10)
AS
IF EXISTS(SELECT * FROM [setting] WHERE id=@ID)
UPDATE [setting] SET 
	 textValue = @TOPTEXT,
	 enableFlag = @status
	WHERE id=@ID
ELSE
INSERT INTO [setting](
	textValue,
	enableFlag,
	type
	)VALUES(
	@TOPTEXT,
	@status,
	@type
	)

GO


